<?php


namespace App\Models\activity;


use App\Models\Model;
use App\Models\User;

class ActivityAdmin extends Model
{
    protected $fillable = [
        'user_id',
        'status'
    ];

    public function user()
    {
        return $this->hasOne(User::class,'id','user_id');
    }

    /**
     * 检查用户是否有创建权限
     * @param $user_id
     * @return bool
     */
    public function check($user_id)
    {
        $data = self::where('user_id',$user_id)->where('status',1)->first();
        return $data ? true : false;
    }
}